package com.ruoyi.xh.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TablePageDataInfo;
import com.ruoyi.common.core.domain.CommentResult;
import com.ruoyi.xh.domain.XhCeshi;
import com.ruoyi.xh.service.IXhCeshiService;

/**
 * 【请填写功能名称】Controller
 *
 * @author songjw
 * @date 2024-12-13
 */
@Api(tags = "【请填写功能名称】Controller",value = "【请填写功能名称】Controller")
@RestController
@RequestMapping("/xh/ceshi")
public class XhCeshiController extends BaseController {

    @Autowired
    private IXhCeshiService xhCeshiService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('xh:ceshi:list')")
    @GetMapping("/list")
    @ApiOperation("查询【请填写功能名称】列表")
    public TablePageDataInfo<XhCeshi> list(XhCeshi xhCeshi) {
        return TablePageDataInfo.success(xhCeshiService.selectXhCeshiList(xhCeshi));
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('xh:ceshi:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取【请填写功能名称】详细信息")
    public CommentResult<XhCeshi> getInfo(@PathVariable("id") Long id) {
        return CommentResult.success(xhCeshiService.selectXhCeshiById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('xh:ceshi:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增【请填写功能名称】")
    public CommentResult<XhCeshi> add(@RequestBody XhCeshi xhCeshi) {
            xhCeshiService.insertXhCeshi(xhCeshi);
        return CommentResult.success();
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('xh:ceshi:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改【请填写功能名称】")
    public CommentResult<XhCeshi> edit(@RequestBody XhCeshi xhCeshi) {
            xhCeshiService.updateXhCeshi(xhCeshi);
        return CommentResult.success();
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('xh:ceshi:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除【请填写功能名称】")
    public CommentResult<XhCeshi> remove(@PathVariable Long[] ids) {
            xhCeshiService.deleteXhCeshiByIds(ids);
        return CommentResult.success();
    }
}
